/*
MOOOOO
OOOOOO
ABCDEF
UVWXYZ


OOOOOO
MOOOOO
ABCDEF
UVWXYZ

ABCDEF
OOOOOO
MOOOOO
UVWXYZ

UVWXYZ
ABCDEF
OOOOOO
MOOOOO

vector<string> dices;
sort(dices.begin(), dices.end());
bool isMatched = true;

string word;
cin >> word;  要匹配的单词

do {
  // 这只是某一种骰子排列情况下的匹配
  for (int i = 0; i < word.size(); ++i) {
    if (find(dices[i].begin(), dices[i].end(), word[i]) == dices[i].end()) {
      isMatched = false;
    }
  }

  if (isMatched) {
    cout << "YES" << endl;
    break;
  }
  // 循环所有骰子可能的排列组合
} while (next_permutation(dices.begin(), dices.end()));

cout << "NO" << endl;
*/